package com.retail.booking.service.impl;

import cn.hutool.core.collection.CollUtil;
import com.retail.booking.entity.po.BookingUserCreateSharePo;
import com.retail.booking.entity.request.BookingUserCreateShareRequest;
import com.retail.booking.entity.vo.BookingUserCreateShareVo;
import com.retail.booking.mapper.BookingUserCreateShareMapper;
import com.retail.booking.service.BookingUserCreateShareService;
import com.retail.core.entity.ParamReq;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * 用户生成小核酸分享记录 Service impl
 *
 * @author Administrator
 */
@Service
public class BookingUserCreateShareServiceImpl implements BookingUserCreateShareService {

    @Resource
    private BookingUserCreateShareMapper bookingUserCreateShareMapper;

    @Override
    public BookingUserCreateShareVo getModel(Long id) {

        BookingUserCreateShareVo vo = bookingUserCreateShareMapper.getModel(id);

        return vo;
    }

    @Transactional
    @Override
    public Long save(BookingUserCreateShareRequest request) {
        bookingUserCreateShareMapper.save(request);
        return request.getId();
    }

    @Transactional
    @Override
    public Long update(BookingUserCreateShareRequest request) {

        bookingUserCreateShareMapper.update(request);
        return request.getId();
    }

    @Override
    public List<BookingUserCreateShareVo> listPage(ParamReq<BookingUserCreateShareRequest> params) {
        List<BookingUserCreateShareVo> res = bookingUserCreateShareMapper.listPage(params);
        return res;
    }

    @Override
    public Integer countPage(ParamReq<BookingUserCreateShareRequest> params) {
        return bookingUserCreateShareMapper.countPage(params);
    }

    @Override
    public Integer updateDelFlagById(Long id, Integer delFlag) {
        return bookingUserCreateShareMapper.updateDelFlagById(id, delFlag);
    }

    @Override
    public Long saveRequestReturnId(BookingUserCreateShareRequest request) {
        bookingUserCreateShareMapper.save(request);
        return request.getId();
    }
}